package com.browan.constellation.util;

import java.util.Calendar;
import java.util.Date;

public class Util
{


	public static String getDate()
	{
		Calendar calendar = Calendar.getInstance();

		int year = calendar.get(Calendar.YEAR);

		int month = calendar.get(Calendar.MONTH) + 1;

		int day = calendar.get(Calendar.DAY_OF_MONTH);

		String date = year + "-" + month + "-" + day;

		return date;
	}

	public static String getMonthDate()
	{

		Calendar calendar = Calendar.getInstance();

		int year = calendar.get(Calendar.YEAR);

		int month = calendar.get(Calendar.MONTH) + 1;

		String date = year + "-" + (month < 10 ? "0" + month : month);
		return date;
	}

	public static String getRemoveDate()
	{
		Calendar calendar = Calendar.getInstance();

		int year = calendar.get(Calendar.YEAR);

		int month = calendar.get(Calendar.MONTH) + 1;

		int day = calendar.get(Calendar.DAY_OF_MONTH) - 2;

		String date = year + "-" + (month < 10 ? "0" + month : month) + "-" + (day < 10 ? "0" + day : day);

		return date;
	}

	public static String getToday()
	{
		Calendar calendar = Calendar.getInstance();

		int year = calendar.get(Calendar.YEAR);

		int month = calendar.get(Calendar.MONTH) + 1;

		int day = calendar.get(Calendar.DAY_OF_MONTH);

		String date = year + "-" + (month < 10 ? "0" + month : month) + "-" + (day < 10 ? "0" + day : day);

		return date;
	}
	
	
	public static String getTomorrow()
	{
		Calendar calendar = Calendar.getInstance();
		calendar.setTimeInMillis(System.currentTimeMillis() + 60*60*24 * 1000);

		int year = calendar.get(Calendar.YEAR);

		int month = calendar.get(Calendar.MONTH) + 1;

		int day = calendar.get(Calendar.DAY_OF_MONTH);

		String date = year + "-" + (month < 10 ? "0" + month : month) + "-" + (day < 10 ? "0" + day : day);

		return date;
	}
	
	

	public static String getDate(String date)
	{
		Date d = new Date(date.trim());

		Calendar calendar = Calendar.getInstance();

		calendar.setTime(d);

		int year = calendar.get(Calendar.YEAR);

		int month = calendar.get(Calendar.MONTH) + 1;

		int day = calendar.get(Calendar.DAY_OF_MONTH);

		String result = year + "-" + month + "-" + day;
		return result;
	}
}